home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Scene Storm
/
Scene Storm - Volume 1.iso
/
coding
/
asm
/
utils
/
cosaque
/
cosaque6.s
< prev
Wrap
Text File
|
1980-01-03
|
43KB
|
1,927 lines
*******************************************************************************
* Cosaque v3.01 (GUI) Copyright © 1994 The Art/LSd
* ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
* $Release : 3.01 $
* $Revision : 1.00 $
* $Date : 14-Apr-94 $
*
* $Author(s) : Written by The Art/LSd (In MC680x0 Assembly under Asm-One)
* $Note(s) : Position Independacy off a4 - (WARNING: DON`T TRASH A4!)
* : SysBase Ptr is cached so that if running in fastmem access
* : to SysBase ptr is faster. Requires Case Sensitivity enabled.
*
* $Purpose : Nice and Simple sine generation tool with easy to use GUI
*******************************************************************************
CONTEXT_ERROR = 2 /* create context failcode */
GADGETS_ERROR = 3 /* create gadgets failcode */
MENUS_ERROR = 4 /* create menus failcode */
WINDOW_ERROR = 5 /* open window failcode */
FONT_ERROR = 6 /* open font failcode */
SCREEN_ERROR = 7 /* open screen failecode */
VISUAL_ERROR = 8 /* get visual info failcode */
_LVOSPMul = -$4E
_LVOSPFix = -$1E
_LVOSPFlt = -$24
_LVOSPDiv = -$54
_LVOSPAdd = -$42
_LVOSPSub = -$48
incdir gst:
include "os3_gst.i"
*-------------- Definition of Main Variables (Public) Block...
STRUCTURE VarsBlock,0
APTR _SysBase /* ExecBase base */
APTR _DosBase /* DOS lib base */
APTR _IntuitionBase /* Intuition lib base */
APTR _GfxBase /* Graphics lib base */
APTR _GadToolsBase /* GadTools lib base */
APTR _IconBase /* Icon lib base */
APTR _WBBase /* Workbench lib base */
APTR _ScreenPt
APTR _VisualInfo
APTR _WindowPt
APTR _GUI_GList
; APTR _GUI_Menus
APTR _UserPort
APTR _AppIcon /* Application icon (OS2.x+) */
APTR _AppMsgPort /* message ReplyPort (App) */
APTR _DiskObj
APTR _AslBase ;Asl lib base
APTR Asl_Request ;Requester struct
STRUCT PathBuffer,200 ;filepath string buffer
LABEL vars_SIZEOF
********************************************************************************
*-------------- Allocate our variables block
Startup: move.l d0,d7 ;save CLI params len
move.l a0,a5 ;save CLI params ptr
suba.l a1,a1 ;clear a1
move.l 4.w,a6 ;get execbase
CALL FindTask ;find *THIS* task
move.l d0,a4 ;get task ptr
move.l d7,d0 ;restore CLI params len
move.l a5,a0 ;restore CLI params ptr
tst.l pr_CLI(a4) ;did we originate from CLI?
bne.s ProgStart ;yes... call our program
lea pr_MsgPort(a4),a0 ;from wb.. handle wb_startup
move.l a0,a4
CALL WaitPort ;wait for a message
move.l a4,a0
CALL GetMsg ;then get it
move.l d0,-(sp)
bsr.s ProgStart
move.l d0,d7 ;save CLI Return code
move.l 4.w,a6
CALL Forbid
move.l (sp)+,a1
CALL ReplyMsg
move.l d7,d0 ;exit code
rts
ProgStart: move.l #vars_SIZEOF,d0 ;length for our variables
move.l #MEMF_PUBLIC+MEMF_CLEAR,d1 ;we want public mem, cleared
move.l (AbsExecBase).w,a6 ;get SysBase
CALL AllocMem ;allocate it...
move.l d0,a4 ;ptr to our RS.Variables base
bne.s RSValid ;did the alloc fail, if so exit
moveq #VAR_ERROR,d0 ;Memory allocation fail code
rts
RSPtr: dc.l 0
*-------------- From here a4 points to our variables area (DON`T DESTROY A4!)
RSValid: move.l a6,_SysBase(a4) ;cache execptr in publicmem
lea RSPtr(pc),a0
move.l a4,(a0)
*-------------- Open all libs we want to use
lea LibTags(pc),a0 ;pt to library script
bsr.w OpenTagLibs ;open libraries
beq.w ShutDown ;if failed to open.. exit
*-------------- Allocate ASL Requester
move.l _AslBase(a4),a6 ;get asl base in a6
moveq #ASL_FileRequest,d0 ;requester type
lea MainTags(pc),a0 ;taglist
CALL AllocAslRequest ;allocate asl request struct
move.l d0,Asl_Request(a4) ;save request struct
beq.w ShutDown
*-------------- Open Main Screen & Window
Restart: bsr.w SetupScreen ;open our screen
bne.w ShutDown ;exit if error occurs...
*-------------- set sine generation defaults
move.w #COS_YES,SineType ;COS OR JUMP
move.l #NORMAL,DirType ;NORMAL OR UPSIDEDOWN
move.l #0,CosMin ;COS.MIN
move.l #100,CosMax ;COS.MAX
move.l #100,NrData ;NR. OF DATA
move.w #SOURCE,SaveType ;SOURCE or DATA
move.w #"b",_DataType ;DATA TYPE (b,w,l)
move.w #_BYTE,SizeType ;* DON`T FORGET THIS! *
bsr.w OpenWindow ;open our window
bne.w ShutDown ;exit if error occurs...
move.l _GUI_GList(a4),a0
move.l _WindowPt(a4),a1
suba.l a2,a2
moveq #12,d0
CALLREL RefreshGList,_IntuitionBase
*-------------- Check for Intuition events and take appropriate actions
OSWaitLoop: move.l _UserPort(a4),a0 ;a0-->user port
CALLREL WaitPort,_SysBase ;wait for something to happen
move.l _UserPort(a4),a0 ;a0-->window pointer
CALLREL GT_GetIMsg,_GadToolsBase
tst.l d0 ;was there a message ?
beq.s OSWaitLoop ;if not loop back
move.l d0,a1 ;a1-->message
move.l im_Class(a1),d2 ;d2=IDCMP flags
move.w im_Code(a1),d3 ;code ( for VANILLAKEY )
move.l im_IAddress(a1),a2 ;save gadget address
move.w $26(a0),d0 ;gadgetid
PUSHR d0
CALL GT_ReplyIMsg ;reply to message
PULLR d0
cmp.l #CLOSEWINDOW,d2
beq.w ShutDown
cmp.l #GADGETUP,d2 ;class_gadgetup
beq.s GadgetEvent
;cmp.l #MENUPICK,d2 ;did user select menu?
;beq.w MenuEvent
bra.b OSWaitLoop
GadgetEvent tst.l gg_UserData(a2) ;is there a gad jump adr?
beq.s OSWaitLoop ;was a gadget assigned?
move.l gg_UserData(a2),a0 ;get gad jump address
jmp (a0) ;jump to gadget routine
*-------------- Get Menus event numbers
MenuEvent move.w d3,d0 ;\
move.w d3,d1 ;make copies
move.w d3,d2 ;/
and.w #%1111100000000000,d2 ;mask out only submenu
rol.w #5,d2 ;d2.w=SUBITEM NUMBER
and.w #%0000011111100000,d1 ;mask out only item
lsr.w #5,d1 ;d1.w=ITEM NUMBER
and.w #%0000000000011111,d0 ;d0.w=MENU NUMBER
bsr.s _Project ;project menu
bra.w OSWaitLoop
_Project tst.w d0
beq.s menu1
cmp.w #1,d0
beq.s menu2
cmp.w #2,d0
beq.s menu3
bra.w OSWaitLoop
;----------------------------------------------Menus
menu1 tst.w d1
beq.s OpenPrefs
cmp.w #1,d1
beq.s SaveAs
cmp.w #3,d1
beq.s About
cmp.w #5,d1 ;quit program selected on menu?
beq.w ShutDown
bra.w OSWaitLoop
menu2 tst.w d1
beq.s ResetDefaults
cmp.w #1,d1
beq.s LastSaved
cmp.w #2,d1
beq.s Restore
bra.w OSWaitLoop
menu3 tst.w d1
beq.s CrIcons
bra.w OSWaitLoop
;-------------------------------------------Menu 1 Functions
OpenPrefs bra.w OSWaitLoop
SaveAs bra.w OSWaitLoop
;-------------------------------------------Menu 2 Functions
ResetDefaults bra.w OSWaitLoop
LastSaved bra.w OSWaitLoop
Restore bra.w OSWaitLoop
;-------------------------------------------Menu 3 Functions
CrIcons bra.w OSWaitLoop
***********************************************************
About lea btxt(pc),a1
lea bmsg(pc),a2
move.l a2,b1-btxt(a1)
lea ltxt(pc),a2
lea lmsg(pc),a5
move.l a5,b2-btxt(a1)
lea rtxt(pc),a3
lea rmsg(pc),a5
move.l a5,b3-btxt(a1)
moveq #0,d0
moveq #0,d1
move.w #180,d2
move.w #80,d3
suba.l a0,a0
move.l d5,a6
move.l _IntuitionBase(a4),a6
jsr -348(a6)
bra.w OSWaitLoop
btxt: dc.b 0,1,0,0
dc.w 10,10
dc.l 0
b1 dc.l 0,0
ltxt: dc.b 0,1,0,0
dc.w 5,3
dc.l 0
b2 dc.l 0,0
rtxt: dc.b 0,1,0,0
dc.w 5,3
dc.l 0
b3 dc.l 0,0
bmsg: dc.b 'Copyright © 1994 The Art/EX4!',0
lmsg: dc.b ' Okay ',0
rmsg: dc.b ' Okay ',0
even
GetCosineorJump move.w d3,SineType ;SineType (COS or JUMP) .w
bra.w OSWaitLoop
NormorReverse and.l #$0000ffff,d3
move.l d3,DirType ;DirType (NORMAL or UPSIDEDOWN) .l
bra.w OSWaitLoop
DatType move.w d3,SaveType ;SaveType (SOURCE or DATA) .w
bra.w OSWaitLoop
Word tst.w d3
bne.s notbyte
move.w #"b",_DataType
move.w #_BYTE,SizeType
bra.w OSWaitLoop
notbyte: cmp.w #1,d3
bne.s notword
move.w #"w",_DataType
move.w #_WORD,SizeType
bra.w OSWaitLoop
notword: move.w #"l",_DataType
move.w #_LONG,SizeType
bra.w OSWaitLoop
MinSize lea GUI_Gadgets+3*4(pc),a0
move.l (a0),a0
move.l 34(a0),a0
move.l (a0),a0
lea -11*4(a0),a0
move.l (a0),CosMin
bra.w OSWaitLoop
MaxSize
lea GUI_Gadgets+4*4,a0
move.l (a0),a0
move.l 34(a0),a0
move.l (a0),a0
lea -11*4(a0),a0
move.l (a0),CosMax
bra.w OSWaitLoop
Number lea GUI_Gadgets+5*4,a0
move.l (a0),a0
move.l 34(a0),a0
move.l (a0),a0
lea -11*4(a0),a0
move.l (a0),NrData
bra.w OSWaitLoop
CreateSine move.l CosMin,d0
move.l CosMax,d1
beq.s skip
cmp.l d0,d1
ble.s skip
tst.l NrData
beq.s skip
move.l a4,-(sp)
move.l CosMin,_temp1
move.l CosMax,_temp2
move.l NrData,_temp3
bsr.w Do_Sine
move.l _temp1,CosMin
move.l _temp2,CosMax
move.l _temp3,NrData
move.l (sp)+,a4
skip bra.w OSWaitLoop
_temp1: dc.l 0
_temp2: dc.l 0
_temp3: dc.l 0
GetSaveReq
*-------------- Example ASL Requester 'SAVE'
move.l RSPtr(pc),a4
lea SaveTags(pc),a1 ;address of taglist
lea SaveText(pc),a2 ;ptr to requester hail text
bsr.b RequestASL
*-------------- put name into gadget
lea GUI_Gadgets+7*4(pc),a0
lea PathBuffer(a4),a2
bsr CopyStr2Gad
move.l _GUI_GList(a4),a0
move.l _WindowPt(a4),a1
suba.l a2,a2
moveq #12,d0
CALLREL RefreshGList,_IntuitionBase
TypeSaveName: bra.w OSWaitLoop
*******************************************************************************
* RequestASL <NON MODIFIABLE>
* ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
* Prompts user to select a filename using the ASL Requester
*
* $Inputs : a1.l=Requester Tag Structure (PTR)
* : a2.l=Requester Hail Text-String (PTR)
* $Outputs : a0.l=Pathname of selected file, or Points to ZERO if failed
* : d0.b=Flags 0,cancelled, -1,selected
*
* $SR-Flags : Z-Flag Set if requester cancelled.
*******************************************************************************
RequestASL: move.l a2,4(a1) ;hail textptr into tag struct
move.l Asl_Request(a4),a0 ;address of requester struc
move.l _AslBase(a4),a6 ;get asl base
CALL AslRequest ;do request
tst.l d0 ;test d0
beq.s cancelled ;branch if cancelled
lea PathBuffer(a4),a5
move.l Asl_Request(a4),a0 ;address of requester struc
move.l rf_Dir(a0),a1 ;get dir string
move.l a5,a2 ;get output buffer
moveq #56,d0 ;set max size
copy move.b (a1)+,(a2)+ ;copy bytes
dbeq d0,copy ;until end of string or buffer
move.l a5,d1 ;get dir name (copy)
move.l rf_File(a0),d2 ;get file name
move.l #200,d3 ;size of buffer
move.l _DosBase(a4),a6 ;get dos base
CALL AddPart ;create full pathname
tst.l d0 ;test for overflow
beq.s cancelled ;branch on error
moveq #-1,d0 ;initialise count
move.l a5,a0 ;address of buffer
checksize: addq.w #1,d0 ;decrement counter
tst.b 0(a0,d0.w) ;test for zero terminator
bne.s checksize ;branch if not found
cmpi.w #37,d0 ;is count too large
ble.s sizeok ;branch if not
sub.w #37,d0 ;subtract count from numchars
add.w d0,a0 ;add to buff adr so eostr shown
sizeok st.b d0 ;d0=$FF.b (Clear Z-Flag)
rts
cancelled suba.l a0,a0 ;no filename, clear ptr
sf.b d0 ;d0=$00.b (Set Z-Flag)
rts
*******************************************************************************
MainTags: dc.l ASL_Height,200 ;height
dc.l ASL_Width,340 ;width
dc.l TAG_DONE ;end of taglist
SaveTags: dc.l ASL_Hail,0 ;savetext ptr
dc.l ASL_FuncFlags,FILF_SAVE+FILF_PATGAD
dc.l TAG_DONE ;end of taglist
SaveText: dc.b 'Save File',0
even
*******************************************************************************
* Shutdown() - Free all allocated resources & exit program
* ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
* Frees all previously allocated resources, sanity checks are made so only
* allocated memory/open libraries/and so on will be removed if open/alloc`d.
*******************************************************************************
*-------------- Dealloc Open Libraries
ShutDown: move.l RSPtr(pc),a4
move.l Asl_Request(a4),d0 ;get request struct
beq.s no_asl
move.l d0,a0
move.l _AslBase(a4),a6
move.l a6,d7
beq.s no_asl
CALL FreeAslRequest
no_asl
bsr.w CloseWindow
bsr.w CloseDownScreen
lea LibTags(pc),a0 ;pt to taglist of libs to close
bsr.w CloseTagLibs ;close all open libs..
*-------------- Free RS Variables Area
RSFreeMem: move.l a4,a1 ;ptr to our RS.Variables base
move.l #vars_SIZEOF,d0 ;no. of bytes to free
move.l 4.w,a6
CALL FreeMem ;free the memory
moveq #0,d0 ;no return code
rts ;exit...
*******************************************************************************
* IconifyAsApp()
* ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
* Free`s up as much memory as possible then shuts down window`s & screens. Next
* it Opens up an Application Icon on WB screen and waits for user to select it
* before Restarting Program.
*******************************************************************************
IconifyAsApp: bsr.w CloseWindow
bsr.w CloseDownScreen
bsr.s AppIconify
bra Restart
;/* [ CloseDownApp ] *********************************************************/
;Add an Application Icon to WB screen and waits until icon selected then exits.
*-------------- Create App Msgport (for reply)
AppIconify: clr.l _AppMsgPort(a4)
move.l _WBBase(a4),d0
CALLREL CreateMsgPort,_SysBase ; make app msgport
move.l d0,_AppMsgPort(a4)
beq.s FreeApp
*-------------- Get DiskObject (For WB AppIcon access)
lea IconName(pc),a0
CALLREL GetDiskObject,_IconBase ;get icon
move.l d0,_DiskObj(a4)
beq.s FreeApp
*-------------- Create the WB Application Icon
lea SproName(pc),a0 ; Icon name
move.l _AppMsgPort(a4),a1 ; reply port is MSGPort
suba.l a2,a2 ; lock (not used as v39)
move.l _DiskObj(a4),a3 ; disk object (icon image)
move.l a3,d0 ; a3=icon image
beq.s NoDiskOb
moveq #0,d0 ; id
moveq #0,d1 ; userdata
move.l _WBBase(a4),a6 ; is there a WB Libray open?
move.l a4,-(sp) ; stack our RS. Area pt
move.l d0,a4 ; clear a4 - for OS2 TagCompat!
CALL AddAppIconA ; Call call
move.l (sp)+,a4 ; get our RS. area ptr back!
move.l d0,_AppIcon(a4) ; ptr to appicon
*-------------- Wait for user to select icon on WB Screen
NoDiskOb: move.l _SysBase(a4),a6 ; get execbase
moveq #0,d6
WaitOnApp: move.l _AppMsgPort(a4),a0
moveq #0,d0
moveq #1,d1
move.b 15(a0),d1
bset d1,d0
CALL Wait ; wait for msg
move.l _AppMsgPort(a4),a0
CALL GetMsg ; get it...
tst.l d0 ; was there a message ?
beq.s WaitOnApp ;if not loop back
move.l d0,a0
tst.l 32(a0) ; appicon selected?
sne d6 ; set d6 if so..
move.l a0,a1
CALL ReplyMsg ; reply to msg...
tst.b d6
bne.s WaitOnApp
*-------------- Remove Application Icon from Workbench screen (& Kill MsgPort)
FreeApp: move.l _AppMsgPort(a4),d0
beq.s NoPort
move.l d0,a0
CALLREL DeleteMsgPort,_SysBase ;delete msgport
clr.l _AppMsgPort(a4)
*-------------- Free WB Application Icon
NoPort: move.l _AppIcon(a4),d0 ; Our app icon
beq.s No_App
move.l d0,a0
CALLREL RemoveAppIcon,_WBBase ; get rid of app icon
clr.l _AppIcon(a4)
*-------------- Free DiskObject (Used For WB AppIcon access)
move.l _DiskObj(a4),d0 ; d0=disk object
beq.s No_App ; is it valid, if not skip free
move.l d0,a0
CALLREL FreeDiskObject,_IconBase ; free up disk object
clr.l _DiskObj(a4)
No_App: rts
*******************************************************************************
* SaveMem2File
* ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
* $Inputs: a0.l = Filename
* a1.l = Mem Address
* d0.l = Save Length
*
* $Outputs: d0.l = 0 - success
* d0.l = 1 - failure
*******************************************************************************
SaveMem2File: movem.l d2-d7/a0-a6,-(sp)
move.l a0,d1 ;filename
move.l a1,d5 ;progbuffer
move.l d0,d6 ;proglength
move.l #MODE_NEWFILE,d2
move.l _DosBase(a4),a6
jsr _LVOOpen(a6)
move.l d0,d7
beq.b _SaveError
move.l d7,d1 ;fh...
move.l d5,d2 ;adr
move.l d6,d3 ;length
jsr _LVOWrite(a6) ;write file
move.l d7,d1
jsr _LVOClose(a6) ;close file
movem.l (sp)+,d2-d7/a0-a6
moveq #0,d0
rts
_SaveError: movem.l (sp)+,d2-d7/a0-a6
remcode moveq #1,d0
rts
******************************************************************************
* OpenTagLibs() <NON MODIFIABLE>
* ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
* $Inputs : a0.l = Taglist Pt
* $Format eg; : dc DOSName-*,_DOSBase,36
*
* $Outpus : d0.b = $FF.B if FAILED & $00.B if OKAY
* $SR-Flags : Z-Flag cleared on FAIL
******************************************************************************
OpenTagLibs: PUSH d1-d7/a1-a3/a5-a6 ;save registers
move.l _SysBase(a4),a6 ;execbase in a6
move.l a0,a5
.find_tag: tst.w (a5) ;TAG_DONE?
beq.s .tag_done ;end of taglist?
move.l a5,a1 ;start of script
add.w (a5)+,a1 ;a1=library name pt
moveq #0,d7 ;clear d7
move.l d7,d0 ;clear d0 for version no.
move.w (a5)+,d7 ;d7=_XXXBase pt
move.w (a5)+,d0 ;d0=lib version.
PUSHR a1 ;stack libname pt
CALL OpenLibrary ;try to open desired library
PULLR a1 ;get libname pt
move.l d0,(a4,d7.w) ;save lib base (to RS.)
bne.s .find_tag ;did it open? if so open next..
sf.b d0 ;set Z Flag (d0=$00.B) FAILED!
bra.s .pullexit ;clean up stack and return
.tag_done: st.b d0 ;clear Z Flag (d0=$FF.B) OKAY!
.pullexit: PULL d1-d7/a1-a3/a5-a6 ;restore registers
tst.b d0
rts ;libraries opened succefully!
CloseTagLibs: PUSH d0-d7/a0-a3/a5-a6 ;save registers
move.l a0,a5 ;make copy of taglist ptr
move.l 4.w,a6 ;execbase in a6
.find_tag: tst.w (a0)+ ;TAG_DONE?
beq.s .tag_done ;end of taglist?
move.l a4,a1 ;get RS. base
add.w (a0)+,a1 ;create LibBase pt
move.l (a1),d0 ;is this library open?
beq.s .find_tag ;no.. so don`t close it..
move.l d0,a1 ;base of library to close
tst.w (a0)+ ;skip version
PUSHR a0 ;stack script pt
CALL CloseLibrary ;close this library
PULLR a0 ;get script pt
bra.s .find_tag ;next tagitem please!
.tag_done: PULL d0-d7/a0-a3/a5-a6 ;restore registers
script_done: rts ;all open libraries closed..
LibTags: dc DOSName-*,_DosBase,36
dc INTName-*,_IntuitionBase,36
dc GFXName-*,_GfxBase,36
dc GTName-*,_GadToolsBase,36
dc ICName-*,_IconBase,36
dc WBName-*,_WBBase,0
dc ASLName-*,_AslBase,36
dc TAG_DONE
IR: dc.l GTBB_Recessed,1
NR: dc.l GT_VisualInfo,0
dc.l TAG_DONE
DOSName: dc.b "dos.library",0
INTName: dc.b "intuition.library",0
GFXName: dc.b "graphics.library",0
GTName: dc.b "gadtools.library",0
WBName: dc.b "workbench.library",0
ICName: dc.b "icon.library",0
ASLName: dc.b "asl.library",0
even
cnop 0,4
SetupScreen: move.l PubScreenName(pc),a0
move.l _IntuitionBase(a4),a6
jsr _LVOLockPubScreen(a6)
move.l d0,_ScreenPt(a4)
beq.s SError
move.l _ScreenPt(a4),a0
lea TD(pc),a1
move.l _GadToolsBase(a4),a6
jsr _LVOGetVisualInfoA(a6)
move.l d0,_VisualInfo(a4)
beq.s VError
moveq #0,d0
rts
SError: moveq #1,d0
rts
VError: moveq #2,d0
rts
WindowRender:
movem.l d0-d5/a0-a2/a6,-(sp)
move.l _WindowPt(a4),a0
move.b wd_BorderLeft(a0),d4
ext.w d4
move.b wd_BorderTop(a0),d5
ext.w d5
move.l _VisualInfo(a4),NR+4
move.l _VisualInfo(a4),IR+4
move.l _WindowPt(a4),a0
move.l wd_RPort(a0),a2
move.l a2,a0
lea.l IR,a1
move.w #4,d0
add.w d4,d0
move.w #110,d1
add.w d5,d1
move.w #60,d2
move.w #14,d3
move.l _GadToolsBase(a4),a6
jsr _LVODrawBevelBoxA(a6)
move.l _WindowPt(a4),a0
move.l wd_RPort(a0),a0
lea.l GUI_Text0(pc),a1
move.l d4,d0
move.l d5,d1
move.l _IntuitionBase(a4),a6
jsr _LVOPrintIText(a6)
movem.l (sp)+,d0-d5/a0-a2/a6
rts
OpenWindow:
movem.l d1-d4/a0-a5/a6,-(sp)
move.l _ScreenPt(a4),a0
moveq #0,d3
moveq #0,d2
move.b sc_WBorLeft(a0),d2
move.l sc_Font(a0),a1
move.w ta_YSize(a1),d3
addq.w #1,d3
move.b sc_WBorTop(a0),d0
ext.w d0
add.w d0,d3
move.l _GadToolsBase(a4),a6
lea _GUI_GList(a4),a0
jsr _LVOCreateContext(a6)
move.l d0,a3
beq GUI_CError
movem.w d2-d3,-(sp)
moveq #0,d3
lea.l GUI_GTags(pc),a5
GUI_GL:
move.l _SysBase(a4),a6
lea.l GUI_NGads,a0
move.l d3,d0
mulu #gng_SIZEOF,d0
add.l d0,a0
lea.l BufNewGad,a1
moveq #gng_SIZEOF,d0
jsr _LVOCopyMem(a6)
lea.l BufNewGad,a0
move.l _VisualInfo(a4),gng_VisualInfo(a0)
move.l #topaz8,gng_TextAttr(a0)
move.w gng_LeftEdge(a0),d0
add.w (sp),d0
move.w d0,gng_LeftEdge(a0)
move.w gng_TopEdge(a0),d0
add.w 2(sp),d0
move.w d0,gng_TopEdge(a0)
move.l _GadToolsBase(a4),a6
lea.l GUI_GTypes,a0
moveq #0,d0
move.l d3,d1
asl.l #1,d1
add.l d1,a0
move.w (a0),d0
move.l a3,a0
lea.l BufNewGad,a1
move.l a5,a2
jsr _LVOCreateGadgetA(a6)
tst.l d0
bne.s GUI_COK
movem.w (sp)+,d2-d3
bra GUI_GError
GUI_COK:
move.l d0,a3
move.l d3,d0
asl.l #2,d0
lea.l GUI_Gadgets,a0
add.l d0,a0
move.l a3,(a0)
move.l a3,a0
move.l d3,d0
asl.l #1,d0
lea.l GUI_GTypes,a1
add.l d0,a1
GUI_NoGen1:
GUI_TL:
tst.l (a5)
beq.s GUI_DN
addq.w #8,a5
bra.s GUI_TL
GUI_DN:
addq.w #4,a5
addq.w #1,d3
cmp.w #GUI__CNT,d3
bmi GUI_GL
movem.w (sp)+,d2-d3
move.l _GUI_GList(a4),GUI_WG+4
; move.l _GadToolsBase(a4),a6
; lea.l GUI_NewMenu0,a0
; lea.l MTags0,a1
; jsr _LVOCreateMenusA(a6)
; move.l d0,_GUI_Menus(a4)
; beq GUI_MError
;
; move.l d0,a0
; move.l _VisualInfo(a4),a1
; lea.l MTags1,a2
; jsr _LVOLayoutMenusA(a6)
move.w GUI_Left,GUI_Zoom
move.w GUI_Top,GUI_Zoom+2
move.l _GfxBase(a4),a6
move.l _ScreenPt(a4),a1
lea.l sc_RastPort(a1),a1
lea.l GUI_WTitle,a0
move.l #24,d0
jsr _LVOTextLength(a6)
add.w #80,d0
move.w d0,GUI_Zoom+4
move.l _ScreenPt(a4),a0
move.b sc_WBorTop(a0),d0
ext.w d0
lea.l sc_RastPort(a0),a0
add.w rp_TxHeight(a0),d0
addq.w #1,d0
move.w d0,GUI_Zoom+6
moveq #0,d0
move.w GUI_Left,d0
move.l d0,GUI_L+4
move.w GUI_Top,d0
move.l d0,GUI_T+4
move.w GUI_Width,d0
move.l d0,GUI_W+4
move.w GUI_Height,d0
add.w d3,d0
move.l d0,GUI_H+4
move.l _IntuitionBase(a4),a6
suba.l a0,a0
lea GUI_WindowTags(pc),a1
jsr _LVOOpenWindowTagList(a6)
move.l d0,_WindowPt(a4) ;did window open?
beq GUI_WError
move.l d0,a0 ;window pt
move.l wd_UserPort(a0),_UserPort(a4) ;save user port
; move.l _GUI_Menus(a4),a1
; jsr _LVOSetMenuStrip(a6)
*-------------- set default save filename...
lea GUI_Gadgets+7*4(pc),a0
lea fname,a2
bsr CopyStr2Gad
lea GUI_Gadgets+4*4(pc),a0
move.l (a0),a0
move.l 34(a0),a0
move.l (a0),a0
move.b #"1",(a0)
move.b #"0",1(a0)
move.b #"0",2(a0)
lea GUI_Gadgets+5*4(pc),a0
move.l (a0),a0
move.l 34(a0),a0
move.l (a0),a0
move.b #"1",(a0)
move.b #"0",1(a0)
move.b #"0",2(a0)
move.l _GadToolsBase(a4),a6
move.l _WindowPt(a4),a0
suba.l a1,a1
jsr _LVOGT_RefreshWindow(a6)
bsr WindowRender
moveq #0,d0
GUI_Done:
movem.l (sp)+,d1-d4/a0-a5/a6
rts
GUI_CError:
moveq #1,d0
bra.s GUI_Done
GUI_GError:
moveq #2,d0
bra.s GUI_Done
GUI_MError:
moveq #3,d0
bra.s GUI_Done
GUI_WError:
moveq #4,d0
bra.s GUI_Done
*******************************************************************************
* [CLOSE GUI]
* ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
*******************************************************************************
CloseDownScreen move.l _VisualInfo(a4),d0
beq.s NoVis
move.l d0,a0
CALLREL FreeVisualInfo,_GadToolsBase
clr.l _VisualInfo(a4)
NoVis: suba.l a0,a0
move.l _ScreenPt(a4),a1
cmpa.l a0,a1
beq.s NoScr
CALLREL UnlockPubScreen,_IntuitionBase
clr.l _ScreenPt(a4)
NoScr: rts
CloseWindow: ;move.l _GUI_Menus(a4),d0 ;any menus?
; beq.s no_menus
; move.l d0,d7
; move.l _WindowPt(a4),a0
; CALLREL ClearMenuStrip,_IntuitionBase
; move.l d7,a0
; CALLREL FreeMenus,_GadToolsBase
; clr.l _GUI_Menus(a4)
no_menus: move.l _WindowPt(a4),d0
beq.s no_window
move.l d0,a0
CALLREL CloseWindow,_IntuitionBase
clr.l _WindowPt(a4)
no_window: move.l _GUI_GList(a4),d0
beq.s no_gadgets
move.l d0,a0
CALLREL FreeGadgets,_GadToolsBase
clr.l _GUI_GList(a4)
no_gadgets: rts
GD_Gadget00 EQU 0
GD_Gadget10 EQU 1
GD_Gadget20 EQU 2
GD_Gadget30 EQU 3
GD_Gadget40 EQU 4
GD_Gadget50 EQU 5
GD_Gadget60 EQU 6
GD_Gadget70 EQU 7
GD_Gadget80 EQU 8
GD_Gadget90 EQU 9
GD_Gadget100 EQU 10
GD_Gadget110 EQU 11
GD_Gadget120 EQU 12
GD_Gadget130 EQU 13
GUI__CNT EQU 14
PubScreenName:
DC.L WB_Name
WB_Name:
DC.B 'Workbench',0
CNOP 0,2
MTags0: dc.l GTMN_FrontPen,1
dc.l GTMN_NewLookMenus,1
dc.l TAG_DONE
MTags1:
dc.l TAG_DONE
GUI_Zoom:
DC.W 0,0,0,0
GUI_Gadgets:
DCB.L 14,0
BufNewGad:
DC.W 0,0,0,0
DC.L 0,0
DC.W 0
DC.L 0,0,0
TD:
DC.L TAG_DONE
CL:
DC.L GT_VisualInfo,0,TAG_DONE
GUI_Left:
DC.W 98
GUI_Top:
DC.W 31
GUI_Width:
DC.W 310
GUI_Height:
DC.W 144
GUI_GTypes:
DC.W CYCLE_KIND
DC.W CYCLE_KIND
DC.W CYCLE_KIND
DC.W INTEGER_KIND
DC.W INTEGER_KIND
DC.W INTEGER_KIND
DC.W BUTTON_KIND
DC.W STRING_KIND
DC.W BUTTON_KIND
DC.W BUTTON_KIND
DC.W CYCLE_KIND
DC.W TEXT_KIND
DC.W BUTTON_KIND
DC.W BUTTON_KIND
GUI_NGads:
DC.W 4,15,110,15
DC.L Gadget00Text,0
DC.W GD_Gadget00
DC.L PLACETEXT_ABOVE,0,GetCosineorJump
DC.W 4,76,111,15
DC.L Gadget10Text,0
DC.W GD_Gadget10
DC.L PLACETEXT_ABOVE,0,Word
DC.W 4,45,111,15
DC.L Gadget20Text,0
DC.W GD_Gadget20
DC.L PLACETEXT_ABOVE,0,DatType
DC.W 237,15,57,15
DC.L Gadget30Text,0
DC.W GD_Gadget30
DC.L PLACETEXT_ABOVE,0,MinSize
DC.W 238,46,56,15
DC.L Gadget40Text,0
DC.W GD_Gadget40
DC.L PLACETEXT_ABOVE,0,MaxSize
DC.W 241,76,55,15
DC.L Gadget50Text,0
DC.W GD_Gadget50
DC.L PLACETEXT_ABOVE,0,Number
DC.W 68,110,20,14
DC.L Gadget60Text,0
DC.W GD_Gadget60
DC.L 0,0,GetSaveReq
DC.W 91,110,206,14
DC.L 0,0 ;Gadget70Text,0
DC.W GD_Gadget80
DC.L PLACETEXT_IN,0,TypeSaveName
; DC.L 0,0,0
DC.W 2,127,105,14
DC.L Gadget80Text,0
DC.W GD_Gadget80
DC.L PLACETEXT_IN,0,About
DC.W 197,127,101,14
DC.L Gadget90Text,0
DC.W GD_Gadget90
DC.L PLACETEXT_IN,0,ShutDown ;was quit selected?
DC.W 123,15,106,15
DC.L Gadget100Text,0
DC.W GD_Gadget100
DC.L PLACETEXT_ABOVE,0,NormorReverse
DC.W 72,94,222,14
DC.L Gadget110Text,0
DC.W GD_Gadget110
DC.L PLACETEXT_LEFT,0,0
DC.W 123,32,107,59
DC.L Gadget120Text,0
DC.W GD_Gadget120
DC.L PLACETEXT_IN,0,CreateSine
DC.W 110,127,85,14
DC.L Gadget130Text,0
DC.W GD_Gadget130
DC.L PLACETEXT_IN,0,IconifyAsApp
GUI_GTags:
DC.L GTCY_Labels,Gadget00Labels
DC.L GT_Underscore,'_'
DC.L TAG_DONE
DC.L GTCY_Labels,Gadget10Labels
DC.L GT_Underscore,'_'
DC.L TAG_DONE
DC.L GTCY_Labels,Gadget20Labels
DC.L GT_Underscore,'_'
DC.L TAG_DONE
DC.L GTIN_Number,0
DC.L GTIN_MaxChars,10
DC.L STRINGA_Justification,GACT_STRINGCENTER
DC.L GT_Underscore,'_'
DC.L TAG_DONE
DC.L GTIN_Number,0
DC.L GTIN_MaxChars,10
DC.L STRINGA_Justification,GACT_STRINGCENTER
DC.L GT_Underscore,'_'
DC.L TAG_DONE
DC.L GTIN_Number,0
DC.L GTIN_MaxChars,10
DC.L STRINGA_Justification,GACT_STRINGCENTER
DC.L TAG_DONE
DC.L TAG_DONE
DC.L GTST_MaxChars,256
DC.L TAG_DONE
DC.L GT_Underscore,'_'
DC.L TAG_DONE
DC.L GT_Underscore,'_'
DC.L TAG_DONE
DC.L GTCY_Labels,Gadget100Labels
DC.L GT_Underscore,'_'
DC.L TAG_DONE
DC.L GTTX_Text,Gadget110String
DC.L GTTX_Border,1
DC.L TAG_DONE
DC.L TAG_DONE
DC.L GT_Underscore,'_'
DC.L TAG_DONE
Gadget110String:
DC.B '....OK!',0
CNOP 0,2
Gadget00Text:
DC.B '_Sine Type',0
Gadget10Text:
DC.B 'Size of Data',0
Gadget20Text:
DC.B '_Data Type',0
Gadget30Text:
DC.B '_Min.',0
Gadget40Text:
DC.B 'Ma_X.',0
Gadget50Text:
DC.B 'Nr Data',0
Gadget60Text:
DC.B 'R',0
Gadget70Text:
fname: DC.B 'Ram:sinedata',0
Gadget80Text:
DC.B '_About',0
Gadget90Text:
DC.B '_Quit',0
Gadget100Text:
DC.B '_Jump Prefs',0
Gadget110Text:
DC.B 'Status:',0
Gadget120Text:
DC.B 'Create Sine',0
Gadget130Text:
DC.B 'A_ppIcon',0
CNOP 0,2
Gadget00Labels:
DC.L Gadget00Lab0
DC.L Gadget00Lab1
DC.L 0
Gadget10Labels:
DC.L Gadget10Lab0
DC.L Gadget10Lab1
DC.L Gadget10Lab2
DC.L 0
Gadget20Labels:
DC.L Gadget20Lab0
DC.L Gadget20Lab1
DC.L 0
Gadget100Labels:
DC.L Gadget100Lab0
DC.L Gadget100Lab1
DC.L 0
Gadget00Lab0: DC.B 'Cosine',0
Gadget00Lab1: DC.B 'Jump',0
CNOP 0,2
Gadget10Lab0: DC.B 'Byte',0
Gadget10Lab1: DC.B 'Word',0
Gadget10Lab2: DC.B 'Longword',0
CNOP 0,2
Gadget20Lab0: DC.B 'Source',0
Gadget20Lab1: DC.B 'Data',0
CNOP 0,2
Gadget100Lab0: DC.B 'Normal',0
Gadget100Lab1: DC.B 'Reverse',0
CNOP 0,2
topaz8:
DC.L topazFName8
DC.W 8
DC.B $00,$01
topazFName8:
DC.B 'topaz.font',0
CNOP 0,2
GUI_WindowTags:
GUI_L:
DC.L WA_Left,0
GUI_T:
DC.L WA_Top,0
GUI_W:
DC.L WA_Width,0
GUI_H:
DC.L WA_Height,0
DC.L WA_IDCMP,CYCLEIDCMP!INTEGERIDCMP!IDCMP_GADGETUP!STRINGIDCMP!BUTTONIDCMP!TEXTIDCMP!IDCMP_MENUPICK!IDCMP_CLOSEWINDOW!IDCMP_REFRESHWINDOW
DC.L WA_Flags,WFLG_DRAGBAR!WFLG_DEPTHGADGET!WFLG_CLOSEGADGET!WFLG_SMART_REFRESH!WFLG_ACTIVATE
GUI_WG:
DC.L WA_Gadgets,0
dc.l WA_NewLookMenus,1
DC.L WA_Title,GUI_WTitle
DC.L WA_Zoom,GUI_Zoom
DC.L WA_AutoAdjust,1
DC.L TAG_DONE
GUI_WTitle:
DC.B 'Cosaque V3.01 The Art/EX4!',0
CNOP 0,2
GUI_Text0:
DC.B 1,0
DC.B RP_JAM1
DC.B 0
DC.W 17,113
DC.L 0 ;topaz8
DC.L GUI_IText0
DC.L 0
GUI_IText0:
DC.B 'Save',0
VersionStr: dc.b '$VER: ' ;for 'version' command
SproName: dc.b 'Cosaque v3.01',0
IconName: dc.b 'Cosaque',0 ;for 'cosaque.info'
even
*******************************************************************************
* COSAQUE - Sinedata Generation Routines
* ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
*******************************************************************************
COS_YES = 0
COS_NO = 1
UPSIDEDOWN = -1
NORMAL = 1
SOURCE = 0
DATA = 1
_BYTE = 1
_WORD = 2
_LONG = 4
even
Do_Sine: bsr makeit
move.l RSPtr(pc),a4
rts
*-------------- Open MathFFP Library
makeit: move.l 4.w,a6
lea MathFFPName(pc),a1
jsr -408(a6)
move.l d0,_MafBase
beq.w MaffError
*-------------- Set Sinedata parameters
SetParams: move.w _DataType(pc),d6
bset #5,d6
*-------------- Allocate Binary sinedata
move.l NrData(pc),d0
mulu SizeType(pc),d0 ;alloc length
moveq #0,d1 ;mem type
jsr _LVOAllocMem(a6)
move.l d0,_MemBase ;membase ptr
beq Alloc_error
tst.w SineType
bne.s MakeJmpSine
bsr _MakeCosSine ;make 'COS'
bra.s DoSave
MakeJmpSine: bsr _MakeJmpSine ;make 'JUMP'
DoSave: tst.w SaveType
bne.s DoSave2
*-------------- Generate source code...
move.l NrData(pc),d0
mulu #8,d0
moveq #0,d1
jsr _LVOAllocMem(a6)
move.l d0,BufferPt
beq ExitFree
bsr GenerateSrc
*******************************************************************************
;a1 = Start Addr
;d0 = Buffer Length (of generated source-code to save)
movem.l d0-d7/a0-a6,-(sp)
lea GUI_Gadgets+7*4(pc),a0
move.l (a0),a0
move.l 34(a0),a0
move.l (a0),a0 ;a0.l = filename
move.l BufferPt(pc),a1 ;a1.l = mem to save
move.l BufferLen(pc),d0
subq.l #1,d0 ;d0.l = save length
move.l RSPtr(pc),a4
bsr SaveMem2File
movem.l (sp)+,d0-d7/a0-a6
*******************************************************************************
move.l BufferPt(pc),a1 ;d0
move.l NrData(pc),d0 ;d1
mulu #8,d0 ;d1
move.l 4.w,a6
jsr _LVOFreeMem(a6)
bra.s ExitFree
*-------------- Free Binary Sinedata memory
DoSave2: move.l _MemBase(pc),a0
move.l NrData(pc),d0
mulu SizeType(pc),d0
*******************************************************************************
;a0 = Start Addr
;d0 = Buffer Length (of Binary to save)
*-------------- save routine goes here (for Binary data)
movem.l d0-d7/a0-a6,-(sp)
lea GUI_Gadgets+7*4(pc),a0
move.l (a0),a0
move.l 34(a0),a0
move.l (a0),a0 ;a0.l = filename
move.l _MemBase(pc),a1
move.l NrData(pc),d0
mulu SizeType(pc),d0
move.l RSPtr(pc),a4
bsr SaveMem2File
movem.l (sp)+,d0-d7/a0-a6
*******************************************************************************
ExitFree move.l _MemBase(pc),a1 ;d0
move.l NrData(pc),d0 ;d1
mulu SizeType(pc),d0 ;d1
move.l 4.w,a6
jsr _LVOFreeMem(a6)
*-------------- Close MathFFP Library
Alloc_error
move.l _MafBase(pc),a1
jsr -414(a6)
MaffError: rts
*******************************************************************************
* Copy Gadget-data <source> to Record-data <dest>
* ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
* $Inputs: a0.l = string (source)
* a2.l = gadget (dest)
*******************************************************************************
CopyGadStr: move.l (a0),a0
move.l 34(a0),a0
move.l (a0),a0 ;a0=Gadget TextString
move.l a0,a1
moveq #-1,d0
inclen addq.l #1,d0
tst.b (a0)+ ;get string length...
bne.s inclen
bytecopy move.b (a1)+,(a2)+ ;copy byte by byte
dbra d0,bytecopy
rts
*******************************************************************************
* Copy Record-data <source> TO Gadget-data <dest>
* ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
* $Inputs: a0.l = gadget (dest)
* a2.l = string (source)
*******************************************************************************
CopyStr2Gad: move.l (a0),a0
move.l 34(a0),a0
move.l (a0),a0 ;a0=Gadget TextString
move.l a2,a1
moveq #-1,d0
inclen2 addq.l #1,d0
tst.b (a2)+
bne.s inclen2
bytecopy2 move.b (a1)+,(a0)+
dbra d0,bytecopy2
rts
******************************************************************************
* Sine Binary -> Source
*
GenerateSrc: move.l BufferPt(pc),a0
move.l _MemBase(pc),a1
moveq #0,d0
move.l d0,d1
gen2: tst.w d1
bne.s gen3
move.b #10,(a0)+
move.b #9,(a0)+
move.b #'d',(a0)+
move.b #'c',(a0)+
move.b #'.',(a0)+
move.w _DataType(pc),d7 ;either 'b','w' or 'l'
move.b d7,(a0)+
move.b #9,(a0)+
gen3: btst #7,(a1)
beq.s gen4
cmp.w #"b",_DataType
bne.s CheckW3
neg.b (a1)
bra.s nxt3
CheckW3: cmp.w #"w",_DataType
bne.s IsL3
neg.w (a1)
bra.s nxt3
IsL3 neg.l (a1)
nxt3
move.b #$2D,(a0)+
gen4 clr.l d7
cmp.w #"b",_DataType
bne.s CheckW2
move.b (a1)+,d7
bra.s nxt2
CheckW2: cmp.w #"w",_DataType
bne.s IsL2
move.w (a1)+,d7
bra.s nxt2
IsL2: move.l (a1)+,d7
nxt2
clr.w d6
move.l #$2710,d5
gen5: divu d5,d7
tst.w d7
bne.s gen6
tst.w d6
bne.s gen6
swap d7
divu #10,d5
tst.w d5
bne.s gen5
move.b #$30,(a0)+
bra.s gen7
gen6: add.w #$30,d7
move.b d7,(a0)+
clr.w d7
swap d7
moveq #1,d6
divu #10,d5
tst.w d5
bne.s gen5
gen7: addq.l #1,d0
cmp.l NrData(pc),d0
beq.s gen10
cmp.w #7,d1
beq.s gen8
move.b #$2C,(a0)+
gen8: addq.w #1,d1
cmp.w #8,d1
bne.s gen9
clr.w d1
gen9: bra gen2
gen10: move.b #10,(a0)+
move.b #13,(a0)+
clr.b (a0)
sub.l BufferPt(pc),a0
move.l a0,BufferLen
rts
******************************************************************************
CalcSine: move.l CosMin(pc),d0
jsr _LVOSPFlt(a5)
move.l d0,CosMin
move.l CosMax(pc),d0
jsr _LVOSPFlt(a5)
move.l d0,CosMax
move.l NrData(pc),d0
jsr _LVOSPFlt(a5)
move.l d0,_NoData
move.l DirType(pc),d0
jsr _LVOSPFlt(a5)
move.l d0,DirType
rts
_MakeCosSine: move.l _MafBase(pc),a5
bsr.s CalcSine
bsr.s CalcSine2
bra.s CalcSine3
CalcSine2: move.l CosMin(pc),d0
move.l CosMax(pc),d1
jsr _LVOSPAdd(a5)
move.l #$80000042,d1
jsr _LVOSPDiv(a5)
move.l d0,_FFP1
move.l CosMax(pc),d0
move.l CosMin(pc),d1
jsr _LVOSPSub(a5)
move.l #$80000042,d1
jsr _LVOSPDiv(a5)
move.l d0,_FFP2
move.l #$C90FDA43,d0
move.l _NoData(pc),d1
jsr _LVOSPDiv(a5)
move.l d0,_FFP3
rts
CalcSine3: move.l NrData(pc),d7
subq.l #1,d7
move.l #'A',_FFP4
move.l _MemBase(pc),a4
makeffp1: bsr.s MakeFFP
move.l _FFP7(pc),d0
move.l _FFP2(pc),d1
jsr _LVOSPMul(a5)
move.l _FFP1(pc),d1
jsr _LVOSPAdd(a5)
move.l #$80000040,d1
jsr _LVOSPAdd(a5)
jsr _LVOSPFix(a5)
CheckB cmp.w #"b",_DataType
bne.s CheckW
move.b d0,(a4)+
bra.s nxt1
CheckW cmp.w #"w",_DataType
bne.s IsL
move.w d0,(a4)+
bra.s nxt1
IsL move.l d0,(a4)+
nxt1
move.l _FFP4(pc),d0
move.l _FFP3(pc),d1
jsr _LVOSPAdd(a5)
move.l d0,_FFP4
dbra d7,makeffp1
rts
MakeFFP: movem.l d0-d7/a0-a4,-(sp)
move.l #$80000041,d2
move.l d2,_FFP5
move.l d2,_FFP6
move.l #$41,_FFP7
moveq #7,d7
makeffp3: move.l _FFP7(pc),d0
move.l _FFP5(pc),d1
jsr _LVOSPAdd(a5)
move.l d0,_FFP7
bsr.s makeffp4
move.l _FFP7(pc),d0
move.l _FFP5(pc),d1
jsr _LVOSPSub(a5)
move.l d0,_FFP7
bsr.s makeffp4
dbra d7,makeffp3
movem.l (sp)+,d0-d7/a0-a4
rts
makeffp4: moveq #1,d2
makeffp5: move.l _FFP4(pc),d0
move.l _FFP6(pc),d1
jsr _LVOSPDiv(a5)
move.l _FFP5(pc),d1
jsr _LVOSPMul(a5)
move.l d0,_FFP5
move.l _FFP6(pc),d0
move.l #$80000041,d1
jsr _LVOSPAdd(a5)
move.l d0,_FFP6
dbra d2,makeffp5
rts
_MakeJmpSine: move.l _MafBase(pc),a5
bsr.s CalcJmp1
bra.s CalcJmp2
CalcJmp1: clr.l _FFP8
cmp.l #$FFFFFFFF,DirType
bne.s makeffp8
move.l #$800000C1,_FFP8
makeffp8: jsr CalcSine
move.l #$80000042,d0
move.l _NoData(pc),d1
jsr _LVOSPDiv(a5)
move.l d0,_FFP9
rts
CalcJmp2: move.l NrData(pc),d7
subq.l #1,d7
move.l #$800000C1,d6
move.l _MemBase(pc),a4
makeffp9: move.l d6,d0
bsr.s makeffp10
move.l #$80000040,d1
jsr _LVOSPAdd(a5)
jsr _LVOSPFix(a5)
CheckB4 cmp.w #"b",_DataType
bne.s CheckW4
move.b d0,(a4)+
bra.s nxt4
CheckW4 cmp.w #"w",_DataType
bne.s IsL4
move.w d0,(a4)+
bra.s nxt4
IsL4 move.l d0,(a4)+
nxt4
move.l d6,d0
move.l _FFP9(pc),d1
jsr _LVOSPAdd(a5)
move.l d0,d6
dbra d7,makeffp9
rts
makeffp10: move.l d0,d1
jsr _LVOSPMul(a5)
move.l _FFP8(pc),d1
jsr _LVOSPAdd(a5)
move.l d0,d2
move.l CosMax(pc),d0
move.l CosMin(pc),d1
jsr _LVOSPSub(a5)
move.l d2,d1
jsr _LVOSPMul(a5)
move.l DirType(pc),d1
jsr _LVOSPMul(a5)
move.l CosMin(pc),d1
jmp _LVOSPAdd(a5)
_MemBase: ds.l 1
BufferPt: ds.l 1
BufferLen: ds.l 1
_MafBase: ds.l 1
_FFP5: ds.l 1
_FFP6: ds.l 1
_FFP4: ds.l 1
_FFP7: ds.l 1
_FFP1: ds.l 1
_FFP2: ds.l 1
_FFP3: ds.l 1
_FFP9: ds.l 1
_FFP8: ds.l 1
CosMin: ds.l 1
CosMax: ds.l 1
NrData: ds.l 1
_NoData: ds.l 1
DirType: ds.l 1
_DataType ds.w 1
_SaveType ds.w 1
SaveType: ds.w 1
SizeType: ds.w 1
SineType: ds.w 1
even
MathFFPName: dc.b 'mathffp.library',0
;application icon for wb sleep end
end
CNOP 0,2
GUI_NewMenu0:
DC.B NM_TITLE,0
DC.L GUI_MName0
DC.L 0
DC.W 0
DC.L 0,0
GUI_NewMenu1:
DC.B NM_ITEM,0
DC.L GUI_MName1
DC.L GUI_MComm1
DC.W 0
DC.L 0,0
GUI_NewMenu2:
DC.B NM_ITEM,0
DC.L GUI_MName2
DC.L GUI_MComm2
DC.W 0
DC.L 0,0
GUI_NewMenu3:
DC.B NM_ITEM,0
DC.L NM_BARLABEL,0
DC.W 0
DC.L 0,0
GUI_NewMenu4:
DC.B NM_ITEM,0
DC.L GUI_MName4
DC.L GUI_MComm4
DC.W 0
DC.L 0,0
GUI_NewMenu5:
DC.B NM_ITEM,0
DC.L NM_BARLABEL,0
DC.W 0
DC.L 0,0
GUI_NewMenu6:
DC.B NM_ITEM,0
DC.L GUI_MName6
DC.L GUI_MComm6
DC.W 0
DC.L 0,0
GUI_NewMenu7:
DC.B NM_TITLE,0
DC.L GUI_MName7
DC.L 0
DC.W 0
DC.L 0,0
GUI_NewMenu8:
DC.B NM_ITEM,0
DC.L GUI_MName8
DC.L GUI_MComm8
DC.W 0
DC.L 0,0
GUI_NewMenu9:
DC.B NM_ITEM,0
DC.L GUI_MName9
DC.L GUI_MComm9
DC.W 0
DC.L 0,0
GUI_NewMenu10:
DC.B NM_ITEM,0
DC.L GUI_MName10
DC.L GUI_MComm10
DC.W 0
DC.L 0,0
GUI_NewMenu11:
DC.B NM_TITLE,0
DC.L GUI_MName11
DC.L 0
DC.W 0
DC.L 0,0
GUI_NewMenu12:
DC.B NM_ITEM,0
DC.L GUI_MName12
DC.L GUI_MComm12
DC.W 0
DC.L 0,0
DC.B NM_END,0
DC.L 0,0
DC.W 0
DC.L 0,0
GUI_MName0:
DC.B 'Project',0
GUI_MName1:
DC.B 'Open...',0
GUI_MComm1:
DC.B 'O',0
GUI_MName2:
DC.B 'Save As...',0
GUI_MComm2:
DC.B 'A',0
GUI_MName4:
DC.B 'About...',0
GUI_MComm4:
DC.B '?',0
GUI_MName6:
DC.B 'Quit...',0
GUI_MComm6:
DC.B 'Q',0
GUI_MName7:
DC.B 'Edit',0
GUI_MName8:
DC.B 'Reset to Defaults',0
GUI_MComm8:
DC.B 'D',0
GUI_MName9:
DC.B 'Last Saved',0
GUI_MComm9:
DC.B 'L',0
GUI_MName10:
DC.B 'Restore',0
GUI_MComm10:
DC.B 'R',0
GUI_MName11:
DC.B 'Settings',0
GUI_MName12:
DC.B 'Create Icons...',0
GUI_MComm12:
DC.B 'I',0
CNOP 0,2